<template>
	<view class="content">
		<!-- #ifdef H5 || APP-PLUS -->
		<view class="message-title">
			<commonTitleNear :title="title"></commonTitleNear>
		</view>
		<!-- #endif -->
		<scroll-view scroll-y="true" class="scroll-Y scroll-box">
			<view class="goodsList">
				<good v-for="(item,index) in list" :key="index" :goodsInfo="item" @goodDetail="goodDetail"></good>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import commonTitleNear from'../../components/titile-near/title.vue'
	import good from '../../components/goods/good-special.vue'
	export default{
		data(){
			return{
				list:"", //商品列表
				apptoken:"",
				title:""
			}
		},
		components:{
			commonTitleNear,
			good
		},
		onLoad(option){
			this.title = option.title;
			this.apptoken = uni.getStorageSync("apptoken");
			this.getgoodsRecommend();
			
		},
		methods:{
			goodDetail(id,coupon_amount,price,commission_rate,coupon_start_time,coupon_end_time){
				//商品详情
				const _this = this;
				uni.setStorage({
				    key: 'yongjin',
				    data:(price * (commission_rate / 100/100) * 0.8).toFixed(2),
						success() {
							_this.$CommonJS.navigateTo('../goodDetail/good-detail?id='+id);
						}
						
				});
				
				
			},
			getgoodsRecommend(){
					const _this = this;
					uni.getStorage({
						key:"special",
						success(res){
							console.log(res);
							_this.list = res.data;
						}
					})
			}
		}
	}
</script>

<style>
	@import url("specialArea.css");
</style>
